package com.example.springbootmybatisplus.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.springbootmybatisplus.dao.TestTableMapper;
import com.example.springbootmybatisplus.entity.TestTable;
import com.example.springbootmybatisplus.service.ITestTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 测试-表 前端控制器
 * </p>
 *
 * @author 小旋风
 * @since 2021-07-27
 */
@RestController
@RequestMapping("/test-table")
public class TestTableController {

        @Autowired
    private ITestTableService testTableService;

    @Autowired
    private TestTableMapper testTableMapper;

    @RequestMapping(value = "/getCustomOne",method = RequestMethod.GET)
    public TestTable getCustomOne(){
        //这个方法主要是验证 mapper跟xml文件 关联上了，mapper-locations生效了
        return testTableMapper.getCustomOne();
    }

    @RequestMapping(value = "/page",method = RequestMethod.GET)
    public IPage<TestTable> page(){
        Page<TestTable> page = new Page();
        page.setSize(10);
        return testTableService.page(page);
    }
}
